[codex] Structure client VCS action errors#3263
Conversation
Co-authored-by: codex <codex@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ApprovabilityVerdict: Approved This PR restructures VCS action error classes to include structured context fields (operation, environmentId, cwd) instead of plain message strings. The refactor is mechanical with no changes to error-throwing logic or runtime behavior, and includes comprehensive tests for the new error shapes. You can customize Macroscope's approvability policy. Learn more. |
Co-authored-by: codex <codex@users.noreply.github.com>
Dismissing prior approval to re-evaluate 8fadd1b
Co-authored-by: codex <codex@users.noreply.github.com>
Dismissing prior approval to re-evaluate fa41678
Summary
Validation
vp test packages/client-runtime/src/state/vcsAction.test.ts(11 tests)vp check(passes; 20 pre-existing warnings)vp run typecheckNote
Medium Risk
Changes error types and messages across all VCS action entry points and progress consumption; UI that matched on old string messages may need updates, but behavior for successful paths is unchanged.
Overview
Replaces ad-hoc string failures for client source-control actions with Effect Schema tagged errors that carry operation, target, and action identity instead of copying sensitive remote text into error messages.
VcsActionUnavailableErrornow includesoperation,environmentId, andcwdwith a derived user-facing message; web hooks insourceControlActions.tsbuild this inline after removingunavailableResult.consumeVcsActionProgresssplits execution failures intoVcsActionRemoteFailureError(phase +remoteMessageLengthonly) andVcsActionMissingTerminalEventErrorwhen the progress stream never terminates;VcsActionExecutionErroris now a union of those two.parseVcsActionTargetKeyis schema-validated and throwsVcsActionTargetKeyParseErrorwith key length and native cause, not the raw key. The stacked-action command cache keys unavailable targets per partialenvironmentId/cwdrather than a single shared unavailable key.Tests assert diagnostics stay structural and do not embed credentials or full remote payloads in
.message.Reviewed by Cursor Bugbot for commit fa41678. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Structure VCS action errors with operation, environmentId, and cwd context
VcsActionUnavailableErrorwith structured fields (operation,environmentId,cwd) and a standardized message getter across all VCS action hooks in sourceControlActions.ts.VcsActionRemoteFailureError(foraction_failedevents, omitting remote message body but recording its length) andVcsActionMissingTerminalEventError(for protocol cases with no terminal event).VcsActionTargetKeyParseErrorfor invalid target key parsing, reporting only key length to avoid leaking sensitive content.unavailableResulthelper and replaces all call sites with directAsyncResult.failureconstruction using the new structured error shape.consumeVcsActionProgressandtrack()now receive specific typed error variants instead of a generic error; remote failure messages are no longer forwarded to the client.Macroscope summarized fa41678.